import Payment from './payment.js'
/**
 * App支付对象
 * @module AppPayment
 */
class AppPayment extends Payment {

	constructor(name) {
		super(name);
	};

	async pay(option) {
		const options = {
			timeStamp: '',
			nonceStr: '',
			package: '',
			signType: '',
			paySign: '',
			...option
		};
		return new Promise((resolve, reject) => {
			uni.requestPayment({
				provider: 'wxpay',
				timeStamp: options.timeStamp,
				nonceStr: options.nonceStr,
				package: options.package,
				signType: options.signType,
				paySign: options.paySign,
				success: res => resolve(res),
				fail: res => reject(res)
			});
		});
	}
}

export default new AppPayment("AppPayment");